package com.codedancer.campus.po;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.codedancer.campus.common.typehandler.CodeEnumTypeHandler;
import com.codedancer.campus.enums.ChatMessageContentType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@TableName(value = "contact_admin_chat_message", autoResultMap = true)
@Table(name = "contact_admin_chat_message", comment = "联系管理员聊天信息")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ContactAdminChatMessage {

    @TableId
    @TableField("uuid")
    @Column(name = "uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isKey = true, isNull = false, comment = "uuid")
    private String uuid;

    @TableField("content")
    @Column(name = "content", type = MySqlTypeConstant.TEXT, isNull = false, comment = "消息内容")
    private String content;

    @TableField("send_user_uuid")
    @Column(name = "send_user_uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = true, comment = "发送人uuid")
    private String sendUserUuid;

    @TableField("receive_user_uuid")
    @Column(name = "receive_user_uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = true, comment = "接收人uuid")
    private String receiveUserUuid;

    @TableField("send_admin_uuid")
    @Column(name = "send_admin_uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = true, comment = "发送管理员uuid")
    private String sendAdminUuid;

    @TableField("receive_admin_uuid")
    @Column(name = "receive_admin_uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = true, comment = "接收管理员uuid")
    private String receiveAdminUuid;

    @Column(name = "create_time", type = MySqlTypeConstant.DATETIME, isNull = false, comment = "创建时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Column(name = "update_time", type = MySqlTypeConstant.DATETIME, isNull = false, comment = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField("contact_admin_chat_room_uuid")
    @Column(name = "contact_admin_chat_room_uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = false, comment = "联系管理员聊天室uuid")
    private String contactAdminChatRoomUuid;

    @TableField(value = "content_type", typeHandler = CodeEnumTypeHandler.class)
    @Column(name = "content_type", type = MySqlTypeConstant.TINYINT, length = 1, isNull = false, comment = "消息类型 1表示文字 2表示图片 3表示视频")
    private ChatMessageContentType contentType;
}
